package com.tanhua.model.vo;

import com.tanhua.model.domain.UserInfo;
import com.tanhua.model.mongo.Voice;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

/**
 * @author Administrator
 * @version 1.0
 * @description: TODO
 * @date 2021/11/7 19:16
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class VoiceVo {
    private Long id;
    private String avatar; //头像
    private String nickname; //昵称
    private String gender; //性别
    private Integer age; //年龄
    private String soundUrl; //音频URL
    private Integer remainingTimes; //剩余次数

    public static VoiceVo init(UserInfo userInfo, Voice voice) {
        VoiceVo vo = new VoiceVo();
        //copy用户属性
        BeanUtils.copyProperties(userInfo,vo);  //source,target
        vo.setSoundUrl(voice.getVoiceUrl());
        return vo;
    }

}
